<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>关键字</title>
		
		<meta http-equiv="pragma" content="no-cache" />
	<meta http-equiv="cache-control" content="no-cache" />
	<meta http-equiv="expires" content="0" />    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3" />
	<meta http-equiv="description" content="This is my page" />
		 <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/themes/flexigrid/css/flexigrid.css" />
		<script type="text/javascript" src="<%=request.getContextPath() %>/script/jquery.js"></script>
		<script type="text/javascript" src="<%=request.getContextPath() %>/script/grid/flexigrid.js"></script>
		<style type="text/css" media="all"> 
			@import "<%=request.getContextPath() %>/themes/flexigrid/css/thickbox.css"; 
		</style>
		<link rel="alternate stylesheet" type="text/css" href="<%=request.getContextPath() %>/themes/flexigrid/css/1024.css" title="1024 x 768" />
		<script src="<%=request.getContextPath() %>/script/grid/thickbox.js" type="text/javascript"></script>
		

	</head>

	<body>
	
	<div class="bborderx">
		<table id="flex1" style="display:none"></table>
	</div>
	
		<script type="text/javascript">
			$("#flex1").flexigrid
			(
			{
			url: '<%=request.getContextPath() %>/sysDic.do?action=standGridQuery',
			dataType: 'json',
			errormsg: '连接错误！',
			colModel : [
				{display: '主键', name : 'id', width : 60, sortable : true, align: 'left',hide: true},
				{display: '编号', name : 'numid', width : 60, sortable : true, align: 'center'},
				{display: '模板名称', name : 'templateName', width : 60, sortable : true, align: 'center'},
				{display: '模板标记', name : 'templatePlate', width : 100, sortable : true, align: 'left'},
				{display: '模块名称', name : 'moduleName', width : 60, sortable : true, align: 'left'},
			    {display: '模块标记', name : 'modulePlate', width : 60, sortable : true, align: 'left'},
			    {display: '替换html', name : 'moduleHtml', width : 100, sortable : true, align: 'left',hide: true},
			    {display: '模板主键', name : 'templateId', width : 100, sortable : true, align: 'left' ,hide:true},
			    {display: '填写时间', name : 'sys_time', width : 60, sortable : true, align: 'left'}
				],
			buttons : [
				{name: '请选择', bclass: 'add', onpress : exOperation},
				{separator: true}
				],
			searchitems : [
				{display: '模板名称', name : 'moduleName', isdefault: true},
				{display: '模板标示', name : 'modulePlate'}
				],
			sortname: "id",
			sortorder: "asc",
			usepager: true,
			title: '模块管理',
			useRp: true,
			singleSelect: false,
			ifDblclick: false,
			rp: 10,
			showTableToggleBtn: true,
			width: 750,
			height: 200
			}
			);
			
			//操作数据
			function exOperation(com,grid){
				if (com=='请选择'){
					if( $('.trSelected',grid).length>0){
						 var  moduleName ="";
						 var  modulePlate ="";
						 var moduleId = "";
						 $('.trSelected td:nth-child(3) div',grid).each(function(i){   
				                if(i)moduleName+=',';   
				                moduleName+=$(this).text();   
				            }) 
				            $('.trSelected td:nth-child(1) div',grid).each(function(i){   
				                if(i)moduleId+=',';   
				                moduleId+=$(this).text();   
				            }) 
				            
				            $('.trSelected td:nth-child(4) div',grid).each(function(i){   
				                if(i)modulePlate+=',';   
				                modulePlate+=$(this).text();   
				            }) 
				            
				            window.opener.document.all.moduleName.value = moduleName;
				            window.opener.document.all.moduleId.value = moduleId;
				            window.opener.document.all.modulePlate.value = modulePlate;
				            window.close();
				        
					 }else{
					   alert("请选择一行数据！");
					 }
				}
			}	
	     	
	</script>

	</body>
</html>
